package com.jack.xiaoer.web.advice;

import com.jack.xiaoer.util.AjaxResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * Created by Jackaroo Zhang on 2018/12/14.
 */
@ControllerAdvice
public class CommonExceptionHandler {

    @ExceptionHandler({IllegalArgumentException.class})
    public AjaxResponse handlException(IllegalArgumentException e) {
        if (e != null) {
            return AjaxResponse.invalid(e.getMessage());
        }

        return null;
    }

}
